<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>修改会员昵称</title>
    
    <script src="<%=basePath%>js/fontSize.js"></script>
    <script src="<%=basePath%>js/jquery-1.11.3.min.js"></script>
    
    <link rel="stylesheet" href="<%=basePath%>css/style.css"/>
    <link rel="stylesheet" href="<%=basePath%>css/style2.css"/>
    
    <link rel="stylesheet" href="<%=basePath%>plugins/layer/mobile/need/layer.css"/>
    <script src="<%=basePath%>plugins/layer/mobile/layer.js"></script>
    
    
    <style>
  		body{ background:#F5F5F6;}
	</style>
</head>

<body>
  <!--头部1-->
  <header class="header3 padding-lr1 background6">
    <p class="header3-left"><a href="<%=basePath%>member/info"><span class="ico bgico-7" style="background-image: url(<%=basePath%>images/img25.png)"></span></a></p>
    <h2 class="header3-title text-align-center color1">我的寻宝</h2>
    <div class="header3-right">
      <figure class="dolamr">
      
        <div class="dolamr-zksq color1">
         	<a href="javascript:void(0)" id="sub">确定</a>
        </div>
      </figure>
    </div>
    
    <div class="clear-both"></div>
  </header>
  <!--/头部1-->
  <div style="border:1px solid #06c1ae;margin:0.5rem;padding:0.3rem 0.5rem;background:#ffffff;font-size:16px;">
  	<label for="nick_name" style="width:20%;">会员昵称：</label>
  	<input type="text" value="${name}" id="nick_name" style="border:0px;width:80%;" />
  </div>
  <script type="text/javascript">
  	$(function(){
  		var t=$("#nick_name").val(); 
  		$("#nick_name").val("").focus().val(t);
  		$("#sub").on("click", function() {
  			if (null == $("#nick_name").val() || $("#nick_name").val() == "") {
  				$("#nick_name").focus();
  				layer.open({
  					content: '请输入用户昵称',
  					skin: 'msg',
  					time: 2 //2秒后自动关闭
  				});
  				return;
  			}
  			
  			//loading带文字
  			var li = layer.open({
  				type: 2,
  				content: '正在修改用户昵称'
  			});
  			
  			var ctx = "${pageContext.request.contextPath}";
  	  		$.ajax({
  	  		    type : "post",
  	  		    url : ctx+'/member/setName',
  	  		    dataType:"json",
  	  		  	data: {
  		        	name : $('#nick_name').val()
  		        },
  	  		    success : function(msg) {
  	  		    	layer.close(li);
  	  		    	layer.open({
  	  					content: msg.msg,
  	  					skin: 'msg',
  	  					time: 2 //2秒后自动关闭
  	  				});
  	  		    	if (msg.code == -1) {
  	  		    		window.location.href = ctx+"/again_login.jsp?page=/member/info";
  	  		    	}
  	  		    }
  	  		});
  		});
  	});
  </script>
</body>
</html>